<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if !IE]><!-->
<html lang="zh">
<!--<![endif]-->
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
%>

<head>
    <meta charset="utf-8"/>
    <%@include file="../common/taglib.jsp" %>
    <title>保险代理后台管理系统</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/>
    <meta content="" name="description"/>
    <meta content="" name="author"/>
    <!-- ================== BEGIN BASE CSS STYLE ================== -->
    <jsp:include page="../common/header.jsp"></jsp:include>
    <!-- ================== END BASE CSS STYLE ================== -->

    <!-- ================== 单独作用于本页表格td ================== -->
    <style>
    </style>
    <!-- ================== 单独作用于本页表格td ================== -->

</head>
<body>
<!-- begin #page-loader -->
<div id="page-loader" class="fade in"><span class="spinner"></span></div>
<!-- end #page-loader -->

<!-- begin #page-container -->
<div id="page-container" class="fade page-sidebar-fixed page-header-fixed">
    <jsp:include page="../common/top.jsp"/>
    <!-- begin #sidebar -->
    <jsp:include page="../common/sitebar.jsp"/>
    <div class="sidebar-bg"></div>
    <div id="content" class="content">
        <div class="row">
            <!-- begin col-12 -->
            <div class="col-md-12">
                <!-- begin panel -->
                <div class="panel panel-inverse">
                    <section class="pad-top-10 pad-bottom-20">
						<input name="role" id="role" type="hidden" value="${role}">

						<hr>
                        <div class="form-wrap mar-bottom-0">
                           <%-- <div class="tab-content">
								<div id="tab6" class="tab-pane fade">--%>
									<form id="myForm7" class="form-horizontal" method="post" onsubmit="return false;"   data-parsley-validate="true">
										<input type="hidden" name="tid" value="${advance.tid}">
										<div style="border: 1px solid;height: auto;margin-bottom: 10px;padding-top: 15px;">
											<div class="form-group" style="margin-left: 30px">
												<label style="font-size: 17px"><b>七日设置历史</b></label>
											</div>
											<table  class="table table-striped table-bordered"
												   style="word-break:break-all;word-wrap:break-word">
												<tr>
													<td>日期</td>
													<td>垫资限额（元）</td>
													<td>实际垫资额（元）</td>
													<td>操作人</td>
												</tr>
													<c:forEach items="${advanceList}" var="advances">
														<tr>
															<%--<td>${fn:substring(advances.createAt,0,10)}</td>--%>
																<td><javatime:format value="${advances.createAt}" pattern="yyyy-MM-dd"/></td>
															<td>${advances.todatAmount}</td>
															<td><c:choose>
																<c:when test="${advances.actualAmount == null}">
																	0
																</c:when><c:otherwise>
																${advances.actualAmount}
															</c:otherwise>
															</c:choose></td>
															<td>${advances.username}</td>
														</tr>
													</c:forEach>
											</table>

											<div class="form-group" style="margin-left: 30px">
												<label style="font-size: 17px"><b>垫资限额设置</b></label>
											</div>
											<div class="form-group">
												<label class="col-md-1 control-label" style="width: 130px;font-weight: bold">日期:</label>
												<div class="col-sm-10">
													<p style="font-weight: bold" class="form-control-static">${fn:substring(advance.createAt,0,10)}</p>
												</div>
											</div>
											<div class="form-group">
												<label class="col-md-1 control-label" style="width: 135px;font-weight: bold">垫资限额(元):</label>
												<div class="col-sm-10">
													<font color="red"><p style="font-weight: bold "   class="form-control-static">${advance.applyAmount}</p></font>
												</div>
											</div>
											<div class="form-group">
												<label class="col-md-1 control-label" style="width: 130px;font-weight: bold">操作人:</label>
												<div class="col-sm-10">
													<p style="font-weight: bold" class="form-control-static">${advance.username}</p>
												</div>
											</div>

										</div>
										<c:choose>
											<c:when test="${advance.auditStatus==3}"></c:when>
											<c:otherwise>
												<div class="form-group">
														<%--<label class="col-md-1 control-label" style="width: 110px">审核意见:</label>
                                                        <div class="input-group" style="width: 120px;padding-left: 13px;">
                                                            <textarea style="width: 400px;height: 100px;" name="remark"></textarea>
                                                        </div>--%>
													<label class="col-md-1 control-label" style="width: 110px">审核意见:</label>
													<div class="col-md-4">
														<textarea class="form-control"  name="remark" rows="4" data-parsley-required="true"  data-parsley-maxlength="100" placeholder="请填写审核意见" data-parsley-required-message="请输入审核意见" data-parsley-maxlength-message="请输入100字符以内"></textarea>
													</div>
												</div>

												<button style="width: 115px;height: auto;margin-left: 110px;" type="button" onclick="openModel1(1)" class="btn btn-primary">通过</button>
												<button style="width: 115px;height: auto;margin-left: 30px;" type="button" onclick="openModel1(2)" class="btn btn-default">驳回</button>
											</c:otherwise>
										</c:choose>

									</form>

							<%--	</div>
                            </div>--%>
                    </section>
                </div>
                <table class="bg-warning">
                	<thead>
							<th width="150">操作事项</th>
							<th width="200">操作人</th>
							<th width="200">操作时间</th>
							<th>备注</th>
                    </thead>
                    <tbody>
					<c:forEach items="${businessLogList}" var="businessLog">
						<tr>
                    	<td>${businessLog.content}</td>
                        <td>${businessLog.createUser.roleName}(${businessLog.createUser.realName})</td>
						<td><javatime:format value="${businessLog.createAt}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                        <td>${businessLog.remark}</td>
						</tr>
					</c:forEach>
                   </tbody>
             </table>
                <!-- end panel -->
            </div>
            <!-- end col-12 -->
        </div>
        <!-- end row -->
    </div>

    <!-- end #content -->
	<%--提示框--%>
	<div class="modal fade" id="modal-dialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		<input type="hidden" name="tid" id="tid">
		<input type="hidden" name="type" id="typee">
		<div class="modal-dialog modal-sm">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
					<h4 class="modal-title">温馨提示</h4>
				</div>
				<div class="modal-body" id="me">

				</div>
				<div class="modal-footer">
					<a href="javascript:;" onclick="doSomeThing()" class="btn btn-sm btn-primary">确定</a>
					<a href="javascript:;" class="btn btn-sm btn-default" data-dismiss="modal">取消</a>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- end page container -->
<jsp:include page="../common/footer.jsp"/>


<!-- ================== END PAGE LEVEL JS ================== -->
<script src="${ctx}/static/js/advance/advance.js"></script>
<script>
   /* $(document).ready(function () {
        App.init();
        TableManageFixedHeader.init();

    });

    //去往编辑页面
    function toedit(id) {
        window.location.href = "/sysuser/toedit/" + id;
    }

    //去往新增页面
    function toadd() {
        window.location.href = "/sysuser/toadd";
    }

    $("#companyId").click(
        function addselect() {
            var date = $("#companyId").val();
            $("#companyId1").hide();
            if (date != 3) {
            } else {
                $("#companyId1").show();
            }
        }
    )

    $(function () {
        var $label=$("#newcontinue").children();
        $label.each(function () {
            var $input=$(this).children();
            var value=$input.datevalue;
            alert(value)
            if(value==1){

            }
        })
    })*/
   /* function openModel1(type) {
        var status = $("#myForm7").submit().parsley();
        if (status.isValid()) {
            if (type == 1) {
                $("#typee").val(1);
                $("#me").html("确认审核通过？");
            } else if (type == 2) {
                $("#typee").val(2);
                $("#me").html("确认审核驳回？");
            }
            $('#modal-dialog').modal({backdrop: 'static', keyboard: false});
        }


        //打开模态框
        function openModel(ids, type) {
            $("#tid").val(ids);
            $("#typee").val(type);
            if (type == 1) {
                $("#me").html("确认审核通过？");
            } else if (type == 2) {
                $("#me").html("确认审核驳回？");
            }
            $('#modal-dialog').modal({backdrop: 'static', keyboard: false});
        }

        function doSomeThing() {
            var tid = $("#tid").val();
            var type = $("#typee").val();
            if (type == 1) {
                Sure();
            } else if (type == 2) {
                NoSure();
            }
            $('#modal-dialog').modal('hide')
        }

        function Sure() {
            var role = $("#role").val();
            var url = null;
            var url2 = null;
            if (role == '0') {
                url = "/channel/checkAdvanceByBusiness";
                url2 = "/channel/toList";
            } else if (role == '1') {
                url = "/channel/checkAdvanceByFinance";
                url2 = "/channel/toList";
            }
            $.ajax({
                url: url,
                type: "POST",
                data: $('#myForm7').serialize(),
                success: function (data) {
                    if (data) {
                        window.location.href = url2;
                    }
                }
            });
        }

        function NoSure() {
            $.ajax({
                url: "/channel/rejectAdvance",
                type: "POST",
                data: $('#myForm7').serialize(),
                success: function (data) {
                    if (data) {
                        window.location.href = "/channel/toList";
                    }
                }
            });
        }
    }*/
</script>
</body>
</html>
